// 设备类型定义
// 从 shangyun-dajiang 项目迁移过来的设备类型枚举

// DJI飞机类型
export enum DRONE_TYPE {
  M30 = 67,
  M300 = 60,
  Phantom4 = 11,
  Phantom4Pro = 18,
  Phantom4RTK = 59,
  Phantom4Advanced = 27,
  Mavic3EnterpriseAdvanced = 77,
}

// DJI负载类型枚举值
export enum PAYLOAD_TYPE {
  FPV = 39,
  H20 = 42,
  H20T = 43,
  H20N = 61,
  EP600 = 50,
  EP800 = 90742,
  M30D = 52,
  M30T = 53,
  XT2 = 26,
  XTS = 41,
  Z30 = 20,
  DockTopCamera = 165,
  M3E = 66,
  M3T = 67,
}

// 设备类型名称映射
export const DEVICE_NAMES = {
  // 飞行器
  [DRONE_TYPE.M30]: 'M30',
  [DRONE_TYPE.M300]: 'M300 RTK',
  [DRONE_TYPE.Phantom4]: 'Phantom 4',
  [DRONE_TYPE.Phantom4Pro]: 'Phantom 4 Pro',
  [DRONE_TYPE.Phantom4RTK]: 'Phantom 4 RTK',
  [DRONE_TYPE.Phantom4Advanced]: 'Phantom 4 Advanced',
  [DRONE_TYPE.Mavic3EnterpriseAdvanced]: 'Mavic 3E',
  
  // 负载
  [PAYLOAD_TYPE.FPV]: 'FPV',
  [PAYLOAD_TYPE.H20]: 'H20',
  [PAYLOAD_TYPE.H20T]: 'H20T',
  [PAYLOAD_TYPE.H20N]: 'H20N',
  [PAYLOAD_TYPE.EP600]: 'P1',
  [PAYLOAD_TYPE.EP800]: 'L1',
  [PAYLOAD_TYPE.M30D]: 'M30 Camera',
  [PAYLOAD_TYPE.M30T]: 'M30T Camera',
  [PAYLOAD_TYPE.XT2]: 'XT2',
  [PAYLOAD_TYPE.XTS]: 'XTS',
  [PAYLOAD_TYPE.Z30]: 'Z30',
  [PAYLOAD_TYPE.DockTopCamera]: 'Dock Camera',
  [PAYLOAD_TYPE.M3E]: 'Mavic 3E',
  [PAYLOAD_TYPE.M3T]: 'Mavic 3T',
}

// 航线数据接口
export interface WaylineData {
  author: string
  createTime: number
  updateTime: number
  flyToWaylineMode: string
  finishAction: string
  droneInfo: {
    droneEnumValue: string
    droneSubEnumValue: string
  }
  payloadInfo: {
    payloadEnumValue: string
    payloadSubEnumValue: string
    payloadPositionIndex: string
  }
  autoFlightSpeed: string
  globalHeight: string
  takeOffRefPoint: string
  takeOffRefPointAGLHeight: string | number
  takeOffSecurityHeight: string | number
  payloadParam: {
    imageFormat: string
    [key: string]: any
  }
  Placemark: PlacemarkData[]
  positionsArr: number[][]
  distance?: number
  duration?: number
  [key: string]: any
}

// 航点数据接口
export interface PlacemarkData {
  Point: {
    coordinates: string
  }
  index: string | number
  useGlobalHeight: string
  ellipsoidHeight?: string
  height: string | number
  useGlobalSpeed: string
  waypointSpeed: string
  useGlobalHeadingParam: string
  waypointHeadingParam: {
    waypointHeadingMode: string
    waypointHeadingAngle: string
    waypointHeadingPathMode: string
    waypointPoiPoint: string
    waypointHeadingPoiIndex: string
  }
  useGlobalTurnParam: string
  waypointTurnParam: {
    waypointTurnMode: string
    waypointTurnDampingDist: string
  }
  useStraightLine: string
  gimbalPitchAngle: string
  actionGroup: ActionGroup[]
}

// 动作组接口
export interface ActionGroup {
  actionGroupId: string
  actionGroupStartIndex: string | number
  actionGroupEndIndex: string | number
  actionGroupMode: string
  actionTrigger: {
    actionTriggerType: string
    actionTriggerParam?: string
  }
  action: ActionData[]
}

// 动作数据接口
export interface ActionData {
  actionId: string | number
  actionActuatorFunc: string
  actionActuatorFuncParam: {
    [key: string]: any
  }
}
